<%@ include file="/common/taglibs.jsp"%>
<%@ page import="java.sql.*"  %>
<HTML>
<HEAD>

<style>
h1 {
	font-family: Arial, sans-serif;
	font-size: 24pt;
	color: #08185A;
	font-weight: 100;
	margin-bottom: 0.1em
}

h2.co {
	font-family: Arial, sans-serif;
	font-size: 24pt;
	color: #FFFFFF;
	margin-top: 0.1em;
	margin-bottom: 0.1em;
	font-weight: 100
}

h3.co {
	font-family: Arial, sans-serif;
	font-size: 16pt;
	color: #000000;
	margin-top: 0.1em;
	margin-bottom: 0.1em;
	font-weight: 100
}

h3 {
	font-family: Arial, sans-serif;
	font-size: 16pt;
	color: #08185A;
	margin-top: 0.1em;
	margin-bottom: 0.1em;
	font-weight: 100
}

th {
	font-size: 12px;
	background: #015289;
	color: #FFFFFF;
	font-weight: bold;
	height: 30px;
}

#frmTransaction td {
	font-size: 12px;
	background: #DDE8F3
}

.pageTitle {
	font-size: 24px;
}
</style>
</HEAD>
<script language="JavaScript">
function validate(){
	var frm = document.frmTransaction;
	var optFields = Array('description[delivery_address_2]','description[delivery_state]','description[delivery_telephone]','description[delivery_fax]', 'description[billing_address_2]','description[billing_state]', 'description[billing_telephone]','description[billing_fax]');
	var aName = Array();
	aName['account_id'] = 'Account ID';
	aName['reference_no'] = 'Reference No';
	aName['description'] = 'Description';
	aName['name'] = 'First Name';
	aName['name_2'] = 'Last Name';
	aName['address'] = 'Address 1';
	aName['city'] = 'City';
	aName['state'] = 'State';
	aName['postal_code'] = 'Post Code';
	aName['country'] = 'Country';
	aName['email'] = 'Email';

	for(var i = 0; i < frm.elements.length ; i++){
		
		if(!optFields.inArray(frm.elements[i].name)){
			if(frm.elements[i].value.length == 0){
				alert("Invalid input for " + aName[frm.elements[i].name]);
				frm.elements[i].focus();
				return false;
			}
			
			if(frm.elements[i].name == 'email]'){
				if(!validateEmail(frm.elements[i].value)){
					alert("Invalid input for " + aName[frm.elements[i].name]);
					frm.elements[i].focus();
					return false;
				}		
			}
			if(frm.elements[i].name == 'reference_no]'){
				var d = new Date();
				frm.elements[i].value = d.getTime();
			}
		}
	}  
	return true;
}
function validateEmail(email) {
    //Validating the email field
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
	//"
    if (! email.match(re)) {
        return (false);
    }
    return(true);
}


Array.prototype.inArray = function (value)
// Returns true if the passed value is found in the
// array.  Returns false if it is not.
{
    var i;
    for (i=0; i < this.length; i++) {
        // Matches identical (===), not just similar (==).
        if (this[i] === value) {
            return true;
        }
    }
    return false;
};

</script>
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<center>

<s:form id="frmTransaction" name="frmTransaction" action="/master/paymentebs/secure.jsp" method="post" validate="true" onSubmit="return validate()">
<!--<form method="post" action="/master/paymentebs/secure.jsp" name="frmTransaction" id="frmTransaction" onSubmit="return validate()">
--><input name="return_url" type="hidden" size="60" value="http://localhost:8080/savePaymentStatus?DR={DR}" />



<input name="account_id" type="hidden" value="5880" />
<input name="mode" type="hidden" value="TEST" />
<input name="reference_no" type="hidden" value="${payment.id}" />
<input name="amount" type="hidden" value="${payment.paidAmount}" />
<input name="paidFor" type="hidden" value="${payment.paidFor}" />


<table width="100%" cellpadding="2" cellspacing="2" border="0">
	<tr>
		<!-- <td class="fieldName" width="50%">Account Id</td>
		<td align="left" width="50%"><input name="account_id" type="text" value="5880" /></td> -->
	</tr>
	<tr>
		<th colspan="2"  style="padding-top:5px">Transaction Details</th>
	</tr>
	<tr>
		<td  style="padding-top:5px" align="right" width="50%">Reference Payment Id</td>
		<td  style="padding-top:5px" width="50%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ${payment.id} </td>
	</tr>
	<tr>
		<td  style="padding-top:5px" align="right">Amount in INR</td>
		<td  style="padding-top:5px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${payment.paidAmount}</td>
	</tr>
	<tr>
		<td style="padding-top:5px" align="right">Description</td>
		<td style="padding-top:5px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${payment.paidFor}</td>
	</tr>

	
	<tr>
		<!-- <td class="fieldName">Return Url</td>
		<td align="left"><input name="return_url" type="text" size="60" value="http://localhost:8080/jsp2/paymentGateway/ebs/response.jsp?DR={DR}" /></td> -->
	</tr>
	<tr>
		<!-- <td class="fieldName">Mode</td>
		<td align="left"><select name="mode">
			<option value="TEST">TEST</option>
			<option value="LIVE">LIVE</option>
		</select></td> -->
	</tr>
	<tr>
		<td valign="middle" align="center" colspan="2" style="padding-top:5px;padding-bottom:5px;"><input name="submitted" value="Confirm Now" type="submit" /></td>
	</tr>

</table>
</s:form>
<!--</form>
--></center>
<table width='100%' cellpadding='0' cellspacing="0">
	<tr>
		<th width='90%'>&nbsp;</th>
	</tr>
</table>
</body>
</html>